Socket
Socket
Sign inDemoInstall

@stamp/shortcut

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stamp/shortcut

Adds handy shortcuts for stamp composition


Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

@stamp/shortcut

Adds few handy static methods for simpler composition

By composing the @stamp/shortcut into your stamp

MyStamp = MyStamp.compose(Shortcut);

you get few static methods. So, instead of typing

MyStamp.compose({ deepProperties: bla });

you will be able to write

MyStamp.deepProps(bla);

Usage

import Shortcut from '@stamp/shortcut';

const MyStamp = Shortcut
  .methods({ myMethod() {} })
  .props({ foo: 'foo' })
  .deepProps({ deepFoo: { foo: 'foo 2' } })
  .statics({ bar: 'bar' })
  .deepStatics({ deepBar: { bar: 'bar 2' } })
  .conf({ something: 'something' })
  .deepConf({ deepSomething: { something: 'something' } })
  .init((arg, {stamp, args, instance}) => { /* initializer */ })
  .composers(({stamp, composables}) => { /* composer */ });

Or you can import each individual shortcut function:

import {
  methods, props, deepProps, statics, deepStatics, conf, deepConf, init, composers
} from '@stamp/shortcut';

const Stamp1 = methods({
  method1() { }
});
const Stamp2 = props({
  prop2: 2
});
const Stamp3 = init(function () {
  console.log(3);
});
// etc

In this case the functions will not add any static shortcut methods to your stamps, meaning that the following will throw:

methods({ method1() {} }).props(); // Error: undefined "props" is not a function
init(function () {}).init(); // Error: undefined "init" is not a function
// etc

API

Static methods

methods

stamp.methods(Object) -> Stamp

props

stamp.props(Object) -> Stamp

deepProps

stamp.deepProps(Object) -> Stamp

statics

stamp.statics(Object) -> Stamp

deepStatics

stamp.deepStatics(Object) -> Stamp

conf

stamp.conf(Object) -> Stamp

deepConf

stamp.deepConf(Object) -> Stamp

init

stamp.init(...Function) -> Stamp

composers

stamp.composers(...Function) -> Stamp

FAQs

Package last updated on 08 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc